package com.admin.service.impl;

import com.admin.entity.Academy;
import com.admin.dao.AcademyMapper;
import com.admin.entity.Profession;
import com.admin.service.AcademyService;
import com.admin.vo.query.AcademyQueryVo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 学院表 服务实现类
 * </p>
 *
 * @author szy
 * @since 2023-03-02
 */
@Service
public class AcademyServiceImpl extends ServiceImpl<AcademyMapper, Academy> implements AcademyService {

    @Override
    public IPage<Academy> getAcademyByPage(IPage<Academy> page, AcademyQueryVo academyQueryVo) {
        //创建条件构造器对象
        QueryWrapper<Academy> queryWrapper = new QueryWrapper<Academy>();
        //学院名称
        queryWrapper.like(!ObjectUtils.isEmpty(academyQueryVo.getAcademyName()),
                "academy_name",academyQueryVo.getAcademyName());
        //查询并返回数据
        return baseMapper.selectPage(page,queryWrapper);
    }
}
